package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.SupplierService;
import com.ruoyi.system.domain.SupplierPurchaseOrderCount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("/api")
public class ChartDataController extends BaseController {

    @Autowired
    private SupplierService supplierService;


    @GetMapping("/chart-data")
    public AjaxResult getChartData() {
        List<SupplierPurchaseOrderCount> data =supplierService.selectSupplierPurchaseOrderCountByName();
        System.out.println("Returned data: " + data); // 添加此行用于调试
        return  success(data) ;
    }
}
